﻿using Lost_and_Found.Models.DB;
using Lost_and_Found.Models.ObjectManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Mvc;

namespace Lost_and_Found.Controllers
{
    public class UserController : Controller
    {
        //
        // GET: /Profile/
        [Authorize(Roles = "Member, Admin")]
        [HttpGet]
        public ActionResult Index(String name)
        {
            if (name == null)
                return RedirectToAction("Index", "Home");
            else
                if (UserManager.getUser(name) != null)
                {
                    ViewBag.nameAccess = name;
                    return View(UserManager.getUser(name));
                }
                else
                    return RedirectToAction("Error", "User");
        }

        public ActionResult Error()
        {
            return View();
        }

    }
}
